package classics.Singleton;

/**
 * 单例模式 懒汉式
 */
public final class Singleton {
    private Singleton(){
    }
    private static Singleton INSTANCE = null;
    public static Singleton getSingleton(){
        if(INSTANCE ==null){
            synchronized (Singleton.class){
                if(INSTANCE==null){
                    INSTANCE = new Singleton();
                }
            }
        }
        return INSTANCE;
    }
    public static synchronized Singleton check(){
        return INSTANCE;
    }
}
